<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        canvas{
            border:1px solid #ccc ;
        }
    </style>
</head>
<body>
    <script>
         (()=>{
            const canvas = document.createElement('canvas');
            canvas.width = 400 ;
            canvas.height = 400 ;
            document.body.append(canvas);

            const ctx = canvas.getContext('2d');

            ctx.beginPath();
            ctx.moveTo(50,50);
            ctx.lineTo(250,50);
            ctx.stroke();

            ctx.beginPath();
            ctx.strokeStyle = '#00f';
            ctx.lineWidth = 10 ;
            ctx.moveTo(50,200);
            ctx.lineTo(250,200);
            ctx.stroke();

        })();

        (()=>{
            const canvas = document.createElement('canvas');
            canvas.width = 400 ;
            canvas.height = 400 ;
            document.body.append(canvas);

            const ctx = canvas.getContext('2d');

            ctx.moveTo(50,50);
            ctx.lineTo(200,50);
            ctx.lineTo(50,200);
            ctx.stroke();
        })();

    </script>
</body>
</html>